package com.example.lhsama.controller;

import com.example.lhsama.domain.Role;
import com.example.lhsama.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @Date: 2021年10月29日 12:54
 * @Author: LHSAMA
 */
@Controller
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @RequestMapping("/list")
    public ModelAndView list(){
        ModelAndView mv = new ModelAndView();
        List<Role> roles = roleService.list();
        mv.addObject("roles",roles);
        mv.setViewName("role_list");

        return mv;

    }
}
